package top.humbleyuan.linkedlist;

import top.humbleyuan.datastructure.linkedlist.LinkNode;

/**
 * @Author HumbleYuan
 * @Date 2020/5/18 22:34
 * @Des 翻转链表
 */
public class LeetCode_206 {
    public static void main(String[] args) {
        /**
         * 数据准备
         */
        LinkNode head = new LinkNode(3);
        int[] vals = {6,7,8,3};
        head = LinkNode.formLink(head,vals);

        LinkNode temp = head;

        LinkNode preTemp = null;

        while (temp != null) {
            LinkNode backTemp = temp.next;
            temp.next = preTemp;
            preTemp = temp;
            temp = backTemp;
        }

        LinkNode.headToString(preTemp);
    }
}
